package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the question database table.
 * 
 */
@Entity
@NamedQuery(name="Question.findAll", query="SELECT q FROM Question q")
public class Question implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idQuestion;

	private String intitule;

	private int nbChoisMax;

	private int nbChoixMin;

	private int numero;

	private String options;

	private String typeReponse;

	//bi-directional many-to-one association to Enquette
	@ManyToOne
	@JoinColumn(name="idEnquette")
	private Enquette enquette;

	//bi-directional many-to-one association to Reponse
	@OneToMany(mappedBy="question")
	private List<Reponse> reponses;

	public Question() {
	}

	public int getIdQuestion() {
		return this.idQuestion;
	}

	public void setIdQuestion(int idQuestion) {
		this.idQuestion = idQuestion;
	}

	public String getIntitule() {
		return this.intitule;
	}

	public void setIntitule(String intitule) {
		this.intitule = intitule;
	}

	public int getNbChoisMax() {
		return this.nbChoisMax;
	}

	public void setNbChoisMax(int nbChoisMax) {
		this.nbChoisMax = nbChoisMax;
	}

	public int getNbChoixMin() {
		return this.nbChoixMin;
	}

	public void setNbChoixMin(int nbChoixMin) {
		this.nbChoixMin = nbChoixMin;
	}

	public int getNumero() {
		return this.numero;
	}

	public void setNumero(int numero) {
		this.numero = numero;
	}

	public String getOptions() {
		return this.options;
	}

	public void setOptions(String options) {
		this.options = options;
	}

	public String getTypeReponse() {
		return this.typeReponse;
	}

	public void setTypeReponse(String typeReponse) {
		this.typeReponse = typeReponse;
	}

	public Enquette getEnquette() {
		return this.enquette;
	}

	public void setEnquette(Enquette enquette) {
		this.enquette = enquette;
	}

	public List<Reponse> getReponses() {
		return this.reponses;
	}

	public void setReponses(List<Reponse> reponses) {
		this.reponses = reponses;
	}

	public Reponse addRepons(Reponse repons) {
		getReponses().add(repons);
		repons.setQuestion(this);

		return repons;
	}

	public Reponse removeRepons(Reponse repons) {
		getReponses().remove(repons);
		repons.setQuestion(null);

		return repons;
	}

}